The 'atms' resource for your effect contains two sets of information. The first set contains the effect information that is used to construct the standard parameters dialog box. This includes items such as the name of your effect and optional copyright information.
The second set contains the parameter information, which is a description of each parameter that your effect takes. If your effect does not take parameters, there is no information in this set.
The structure of an 'atms' resource is as follows:
resource 'atms' (kEffectatmsRes) {
7,
{
// The resource body goes here
};
};
The header for this resource contains two items: the resource ID, and the number of root level atoms the resource contains.
The first line contains the ID of the 'atms' resource. In this example, the identifier that is used ( kEffectatmsRes ) is also used in the call to GetComponentResource in Listing 14 . This ensures that the right 'atms' resource is read by QuickTime.
The second line contains the number of root atoms in the resource. Each 'atms' resource contains a number of atoms. The number in the second line must contain a count of the number of first-level atoms in the resource.
Warning
It is critical that you update this number if you add or delete atoms from your
'atms'
resource. If this number is larger than the number of atoms in your effect, your effect component can cause QuickTime to crash. If this number is smaller than the number of atoms actually in the resource, users will not be able to adjust the values of some parameters.
The body of the 'atms' resource consists of a number of atom declarations. Each declaration has a header that contains
Each header is followed by the atom's data, which is one or more typed values, such as a string or a long , or a set of child atoms.
Listing 15 shows an example atom that contains a single typed value as its data. Note that the value is a type followed by the data itself. The number of children of the atom is declared as noChildren because the atom contains a typed value.
Listing 15 An example 'atms' atom declaration
kParameterTitleName, kParameterTitleID, noChildren,
{
string { "Dimmer2 Effect Parameters" };
};
The standard information stored in an 'atms' resource is made up of three required atoms and five optional atoms.
For each parameter of the effect, your 'atms' resource must contain a set of atoms in the 'atms' resource that describes that parameter. This description includes the name of the parameter, the type and range of values it can take, and hints on appropriate user interface element for setting this parameter.
A complete description of the information you need to provide for each parameter can be found in "The Parameter Description Format" .
For a basic parameter, there are five atoms that you should supply:
An example of a basic parameter description is shown in Listing 16 .
Listing 16 An example set of parameter description atoms
kParameterAtomTypeAndID, 101, noChildren,
{
OSType { "sden" }; // atomType--the name of this parameter
long { "1" }; // atomID--this is atom number 1
kAtomNotInterpolated; // atomFlags--this parameter cannot be tweened
string { "Scratch Density" }; // atomName--the name of the parameter
// as it will appear in the standard parameters dialog box
};
kParameterDataType, 101, noChildren,
{
kParameterTypeDataLong; // dataType--this parameter contains a
// long value
};
kParameterDataRange, 101, noChildren,
{
long { "0" }; // minimumValue
long { "25" }; // maximumValue
long { "1" }; // scaleFactor--no scaling is applied to this
// parameter
long { "0" }; // precision--0 indicates that this parameter is
// not a floating-point value
};
kParameterDataBehavior, 101, noChildren,
{
kParameterItemControl; // behaviorType--this parameters should be
// represented by a slider
long { "0" }; // behaviorFlags - no flags
};
kParameterDataDefaultItem, 101, noChildren,
{
long { "5" }; // the default value of the parameter
};
| Previous | Chapter Contents | Chapter Top | Next |